using Andromeda.Global.Business.DataObject;
using ForgeIt.Dal.dbo;
using System;

using System.Collections.Generic;
using System.Linq;
using Andromeda.Global.Data;

namespace ForgeIt.Business.Stub
{
	public abstract class LicenseStub : DataObjectModelBase
	{
		#region private fields


		private DBLicense foDBLicense;

        private Application localIdApplication;

        private Customer localIdCustomer;


		#endregion private fields
    
		#region public constructors

		protected LicenseStub()
			: this(new DBLicense())
		{
		}

        protected LicenseStub(Application foIdApplication, Customer foIdCustomer)
          :this()
        {
            SetIdApplication(foIdApplication);
            SetIdCustomer(foIdCustomer);
        }

        protected LicenseStub(Application foIdApplication)
          :this()
        {
            SetIdApplication(foIdApplication);
        }

        protected LicenseStub(Customer foIdCustomer)
          :this()
        {
            SetIdCustomer(foIdCustomer);
        }

		#endregion public constructors
    

		#region internal constructors

		internal LicenseStub(DBLicense foDBLicense)
		{

			this.foDBLicense = foDBLicense;

		}

		#endregion internal constructors
  

		#region protected datasource properties
		

		internal DBLicense DB_DBLicense
		{
			get { return foDBLicense ?? (foDBLicense = new DBLicense()); }
		}

		
		public override DataConnectorCollection DataObjects
		{
			get
			{
				return new DataConnectorCollection { foDBLicense } ;
			}
		}

		

		/// 
		///
		/// 
		public int IdLicense
		{
			get { return DB_DBLicense.IdLicense; }

		}

		/// 
		///
		/// 
		public int IdApplication
		{
			get { return DB_DBLicense.IdApplication; }

			set { DB_DBLicense.IdApplication = value; }

		}

		/// 
		///
		/// 
		public int IdCustomer
		{
			get { return DB_DBLicense.IdCustomer; }

			set { DB_DBLicense.IdCustomer = value; }

		}

		/// 
		///
		/// 
		public int IdTransaction
		{
			get { return DB_DBLicense.IdTransaction; }

			set { DB_DBLicense.IdTransaction = value; }

		}

		/// 
		///
		/// 
		public int LicenseType
		{
			get { return DB_DBLicense.LicenseType; }

			set { DB_DBLicense.LicenseType = value; }

		}

		/// 
		///
		/// 
		public int LicenseStatus
		{
			get { return DB_DBLicense.LicenseStatus; }

			set { DB_DBLicense.LicenseStatus = value; }

		}

		/// 
		///
		/// 
		public byte[] LicenseData
		{
			get { return DB_DBLicense.LicenseData; }

			set { DB_DBLicense.LicenseData = value; }

		}

		/// 
		///
		/// 
		public System.DateTime LicenseExpiryDate
		{
			get { return DB_DBLicense.LicenseExpiryDate; }

			set { DB_DBLicense.LicenseExpiryDate = value; }

		}

		#endregion protected datasource properties
    
		#region protected datasource foreign key properties
    

		///<summary>
		/// Getter method for obtainin a foreign key <see cref="Application"/> object related to this object
		///</summary>
		public virtual Application GetIdApplication()
		{
          return localIdApplication ?? (localIdApplication = new Application(foDBLicense.GetFK_IdApplication()));
		}
    

  		///<summary>
  		/// Setter method for linking this object to a foreign key object
  		///</summary>
  		///<param name="item">The <see cref="Application"/> object to which we want to link our IdApplication</param>
  		public virtual void SetIdApplication(Application item)
        {
          foDBLicense.SetFK_IdApplication(item.DB_DBApplication);
          localIdApplication = new Application(foDBLicense.GetFK_IdApplication());
        }

		///<summary>
		/// Getter method for obtainin a foreign key <see cref="Customer"/> object related to this object
		///</summary>
		public virtual Customer GetIdCustomer()
		{
          return localIdCustomer ?? (localIdCustomer = new Customer(foDBLicense.GetFK_IdCustomer()));
		}
    

  		///<summary>
  		/// Setter method for linking this object to a foreign key object
  		///</summary>
  		///<param name="item">The <see cref="Customer"/> object to which we want to link our IdCustomer</param>
  		public virtual void SetIdCustomer(Customer item)
        {
          foDBLicense.SetFK_IdCustomer(item.DB_DBCustomer);
          localIdCustomer = new Customer(foDBLicense.GetFK_IdCustomer());
        }

  
		#endregion protected datasource foreign key properties
    
		#region protected datasource external key properties
    

  
		#endregion protected datasource external key properties
    
		#region properties
    

		#endregion properties
    
		#region methods methods

		#endregion methods

        #region Static Factories

        public static License GetLicense(int foIdLicense)
        {
          return new License(DBLicense.GetEntity(foIdLicense));
        }
  
        public static IEnumerable<License> ListLicense()
        {
            return (from DBLicense entity in DBLicense.ListEntity() select new License(entity));
        }
        
  
        public static IEnumerable<License> ListLicense(object foIdLicense, object foIdApplication, object foIdCustomer, object foIdTransaction, object foLicenseType, object foLicenseStatus, object foLicenseData, object foLicenseExpiryDate)
        {
            return (from DBLicense entity in DBLicense.ListEntity(foIdLicense, foIdApplication, foIdCustomer, foIdTransaction, foLicenseType, foLicenseStatus, foLicenseData, foLicenseExpiryDate) select new License(entity));
        }
        
        #endregion Static List Methods

	
  }
}